<template>
	<view>
		<rllr></rllr>
		<view class="">
			<view class="padding-xs ">
				<view class="bg-white radius overflow-hidden">
					<view class="bg-main padding-sm flex justify-between align-center">
						<text>我的预约<text class="margin-lr-xs">|</text>累计已约【{{yyjl.count}}】次</text>
						<text @tap="toYyjl('')">全部<text class="cuIcon-right"></text></text>
					</view>
					<view>
						<view class="padding-xs w-25 inline-block">
							<view @tap="toYyjl('C')" class="flex flex-direction align-center relative bg-white radius shadow padding-sm">
								<text class="text-sl text-red">
									<text class="cuIcon-backdelete"></text>
								</text>
								<text class="text-sm">已取消</text>
								<text style="top: -2rpx; right: -2rpx;" class="bg-red text-xs round absolute padding-xxs">{{yyjl.ccount}}</text>
							</view>
						</view>
						<view class="padding-xs w-25 inline-block">
							<view @tap="toYyjl('U')" class="flex flex-direction align-center relative bg-white radius shadow padding-sm">
								<text class="text-sl text-yellow">
									<text class="cuIcon-remind"></text>
								</text>
								<text class="text-sm">未开始</text>
								<text style="top: -2rpx; right: -2rpx;" class="bg-red text-xs round absolute padding-xxs">{{yyjl.ucount}}</text>
							</view>
						</view>
						<view class="padding-xs w-25 inline-block">
							<view @tap="toYyjl('R')" class="flex flex-direction align-center relative bg-white radius shadow padding-sm">
								<text class="text-sl text-blue">
									<text class="cuIcon-notice"></text>
								</text>
								<text class="text-sm">进行中</text>
								<text style="top: -2rpx; right: -2rpx;" class="bg-red text-xs round absolute padding-xxs">{{yyjl.rcount}}</text>
							</view>
						</view>
						<view class="padding-xs w-25 inline-block">
							<view @tap="toYyjl('P')" class="flex flex-direction align-center relative bg-white radius shadow padding-sm">
								<text class="text-sl text-gray">
									<text class="cuIcon-selection"></text>
								</text>
								<text class="text-sm">已完成</text>
								<text style="top: -2rpx; right: -2rpx;" class="bg-red text-xs round absolute padding-xxs">{{yyjl.pcount}}</text>
							</view>
						</view>
						
						
					</view>
				</view>
				
			</view>
			
			
			<view class="padding-xs ">
				<view class="bg-white radius overflow-hidden">
					<view class="bg-main padding-sm flex justify-between align-center">
						<text>核销券</text>
						<text></text>
					</view>
					<view>
						<view v-for="(hxq,index) in hxqs" :key="index" class="padding-xs">
							<view
								class="shadow radius bg-white flex justify-between align-center padding-sm text-lg">
								<text>
									<text>券【{{index+1}}】</text>
									<text>{{hxq.code}}</text>
								</text>
								<text>所属平台：{{qtype[hxq.qtype]}}:</text>
							</view>
						</view>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				yyjl: {
					ccount: 0,
					ucount: 0,
					pcount: 0,
					rcount: 0,
					count: 0,
				},
				hxqs: [],
				qtype: {},
			};
		},
		created: function() {
			this.loadYyjlitems();
			this.loadHxqs();
			this.constant.get("QTYPE").then(data => {
				this.qtype = data.QTYPE;
			});
		},
		methods: {
			toYyjl: function(stu) {
				uni.navigateTo({
					url: `/pages/cyy/yy/search?stu=${stu}`
				})
			},
			loadYyjlitems: function() {
				this.api("/yy/item/count/get").send({
					clientid: this.store.state.client.clientid,
				}).then(data => {
					this.yyjl = data;
					this.$forceUpdate();
				});
			},
			loadHxqs: function() {
				this.api("/hxq/list/get").send({
					clientid: this.store.state.client.clientid,
				}).then(data => {
					this.hxqs = data.hxqs;
					this.$forceUpdate();
				});
			}
		}
	}
</script>

<style>
</style>